Skip to content

soc: apple: {sep,aop}: log the endpoints and services the firmware offers - #593

Open
brentkearney wants to merge 1 commit into
AsahiLinux:asahi-wipfrom
brentkearney:sep-aop-log
Open

soc: apple: {sep,aop}: log the endpoints and services the firmware offers#593
brentkearney wants to merge 1 commit into
AsahiLinux:asahi-wipfrom
brentkearney:sep-aop-log

Conversation

@brentkearney

@brentkearney brentkearney commented Sep 2, 2026

Copy link
Copy Markdown

Both drivers discard the coprocessor's own description of what it offers. This change logs it once per boot during probe(), at the same level as the RTKit syslog output these coprocessors already emit.

Changes

  • sep.rs: enable the dev_info! in process_discover_msg() that prints each advertised SEPOS endpoint (four-character name and endpoint number), and the dev_warn! for unknown discovery message types. Restores the two constants they need, MSG_PARAM_SHIFT and MSG_PARAM_MASK.
  • sep.rs: name discovery message type 1 (MSG_ADVERTISE_OOL, what AppleSEPManager calls the "OOL advertisement": the endpoint's out-of-line buffer size bounds in pages, packed into the data word) and log it, so the unknown-type warning only fires for genuinely unknown messages. SEPOS sends one per endpoint right after the type 0 message; without this it would trip the newly enabled warning seven times per boot.
  • aop.rs: in register_service(), log the name and endpoint of any announced EPIC service that is not aop-audio, las, or als before returning.

dev_dbg! is not an option here: Rust's dev_dbg! routes to Device::pr_dbg(), which is gated on cfg!(debug_assertions) and does not participate in dynamic debug, so it compiles to nothing unless CONFIG_RUST_DEBUG_ASSERTIONS is set.

Why

The set of endpoints SEPOS actually starts has never been visible from Linux on any board, and AOP services with no driver leave no trace. Both lists are the first thing anyone working on these coprocessors needs. On an apple,t6000 / j316s MacBook Pro (16-inch, 2021) the patched kernel prints, during probe:

apple_sep 396400000.sep: Got endpoint Ok("hibe") at 20
apple_sep 396400000.sep: Endpoint 20 OOL buffer sizes 0x01010101
apple_sep 396400000.sep: Got endpoint Ok("stac") at 24
apple_sep 396400000.sep: Endpoint 24 OOL buffer sizes 0x02020202
apple_sep 396400000.sep: Got endpoint Ok("cntl") at 0
apple_sep 396400000.sep: Endpoint 0 OOL buffer sizes 0x00000000
apple_sep 396400000.sep: Got endpoint Ok("xarm") at 19
apple_sep 396400000.sep: Endpoint 19 OOL buffer sizes 0x02020202
apple_sep 396400000.sep: Got endpoint Ok("xars") at 16
apple_sep 396400000.sep: Endpoint 16 OOL buffer sizes 0x02020202
apple_sep 396400000.sep: Got endpoint Ok("pnon") at 21
apple_sep 396400000.sep: Endpoint 21 OOL buffer sizes 0x02020404
apple_sep 396400000.sep: Got endpoint Ok("hdcp") at 14
apple_sep 396400000.sep: Endpoint 14 OOL buffer sizes 0x01010101

and, on the same board, whose AOP node binds only aop-audio and als:

apple_aop 293c00000.aop: No driver for service Ok("wakehint") on endpoint 37
apple_aop 293c00000.aop: No driver for service Ok("accel") on endpoint 33
apple_aop 293c00000.aop: No driver for service Ok("gyro") on endpoint 34
apple_aop 293c00000.aop: No driver for service Ok("als-temp") on endpoint 43
apple_aop 293c00000.aop: No driver for service Ok("cma") on endpoint 42
apple_aop 293c00000.aop: No driver for service Ok("devmotion6") on endpoint 41
apple_aop 293c00000.aop: No driver for service Ok("SPUApp") on endpoint 32
apple_aop 293c00000.aop: No driver for service Ok("aop-voicetrigger") on endpoint 40

Testing

  • Compile-tested against asahi-7.1.6-1 with rustc 1.93.1: drivers/soc/apple/sep.o and aop.o build before and after.
  • CLIPPY=1 introduces no new warnings; rustfmt --check passes.
  • Runtime-tested on the j316s above with asahi-7.1.6-1 plus this patch, sep node enabled: the output above is the complete apple_sep/apple_aop non-RTKit output of one boot. No Unknown discovery message type warning fires, so types 0 and 1 are the only discovery messages this SEPOS sends. Endpoint set matches an earlier kprobe capture from the unpatched driver.

Independent of #592; applies to asahi-wip in either order.

@brentkearney

Copy link
Copy Markdown
Author

Rebased the branch with one addition and runtime results from the patched kernel on the j316s (MacBook Pro 16-inch, 2021, apple,t6000).

Addition: the first boot showed that SEPOS sends a second discovery message (type 1) per endpoint, which the re-enabled dev_warn! would have flagged as unknown seven times per boot. It is the "OOL advertisement" (AppleSEPManager's name): the endpoint's out-of-line buffer size bounds in pages, packed into the data word. The patch now names it MSG_ADVERTISE_OOL and logs it alongside the endpoint line, so the warning is reserved for genuinely unknown types.

Runtime: apple_sep and apple_aop bind at boot and print, in probe order:

apple_sep 396400000.sep: Got endpoint Ok("hibe") at 20
apple_sep 396400000.sep: Endpoint 20 OOL buffer sizes 0x01010101
apple_sep 396400000.sep: Got endpoint Ok("stac") at 24
apple_sep 396400000.sep: Endpoint 24 OOL buffer sizes 0x02020202
apple_sep 396400000.sep: Got endpoint Ok("cntl") at 0
apple_sep 396400000.sep: Endpoint 0 OOL buffer sizes 0x00000000
apple_sep 396400000.sep: Got endpoint Ok("xarm") at 19
apple_sep 396400000.sep: Endpoint 19 OOL buffer sizes 0x02020202
apple_sep 396400000.sep: Got endpoint Ok("xars") at 16
apple_sep 396400000.sep: Endpoint 16 OOL buffer sizes 0x02020202
apple_sep 396400000.sep: Got endpoint Ok("pnon") at 21
apple_sep 396400000.sep: Endpoint 21 OOL buffer sizes 0x02020404
apple_sep 396400000.sep: Got endpoint Ok("hdcp") at 14
apple_sep 396400000.sep: Endpoint 14 OOL buffer sizes 0x01010101
apple_aop 293c00000.aop: No driver for service Ok("wakehint") on endpoint 37
apple_aop 293c00000.aop: No driver for service Ok("accel") on endpoint 33
apple_aop 293c00000.aop: No driver for service Ok("gyro") on endpoint 34
apple_aop 293c00000.aop: No driver for service Ok("als-temp") on endpoint 43
apple_aop 293c00000.aop: No driver for service Ok("cma") on endpoint 42
apple_aop 293c00000.aop: No driver for service Ok("devmotion6") on endpoint 41
apple_aop 293c00000.aop: No driver for service Ok("SPUApp") on endpoint 32
apple_aop 293c00000.aop: No driver for service Ok("aop-voicetrigger") on endpoint 40

No Unknown discovery message type warning fires. The PR description's Testing section is updated from compile-tested to runtime-tested.

…fers

Both drivers discard the coprocessor's own description of what it offers,
which makes the hardware harder to work with than it needs to be.

sep.rs receives two messages per SEPOS endpoint on the discovery endpoint
and drops both. Type 0 carries the endpoint's four-character name and
number; the dev_info! that would print it in process_discover_msg() is
commented out, along with the two constants it needs. Type 1 is what
AppleSEPManager calls the "OOL advertisement": the endpoint's out-of-line
buffer size bounds, in pages, packed into the data word. The driver has no
constant for it, so it would fall through to the (also commented out)
"Unknown discovery message type" warning. Nothing else in the driver
exposes any of this, so the set of endpoints SEPOS actually starts has
never been visible from Linux on any board.

aop.rs matches announced EPIC service names against "aop-audio", "las" and
"als" and returns silently for anything else, so services with no driver
leave no trace either.

Enable the SEP log, name and log the OOL advertisement so that the unknown
type warning only fires for genuinely unknown messages, and add the AOP
log. All of it fires once per boot during probe, alongside the RTKit syslog
output these coprocessors already emit at the same level.

dev_dbg! would be the tidier choice but is not usable here: Rust's
dev_dbg! routes to Device::pr_dbg(), which is gated on
cfg!(debug_assertions), so it compiles to nothing unless
CONFIG_RUST_DEBUG_ASSERTIONS is set and it does not participate in dynamic
debug.

On an Apple MacBook Pro (16-inch, 2021), t6000/j316s, the SEP log yields:

  Got endpoint Ok("hibe") at 20
  Endpoint 20 OOL buffer sizes 0x01010101
  Got endpoint Ok("stac") at 24
  Endpoint 24 OOL buffer sizes 0x02020202
  Got endpoint Ok("cntl") at 0
  Endpoint 0 OOL buffer sizes 0x00000000
  Got endpoint Ok("xarm") at 19
  Endpoint 19 OOL buffer sizes 0x02020202
  Got endpoint Ok("xars") at 16
  Endpoint 16 OOL buffer sizes 0x02020202
  Got endpoint Ok("pnon") at 21
  Endpoint 21 OOL buffer sizes 0x02020404
  Got endpoint Ok("hdcp") at 14
  Endpoint 14 OOL buffer sizes 0x01010101

and the AOP log, for a board whose AOP node only binds aop-audio and als:

  No driver for service Ok("wakehint") on endpoint 37
  No driver for service Ok("accel") on endpoint 33
  No driver for service Ok("gyro") on endpoint 34
  No driver for service Ok("als-temp") on endpoint 43
  No driver for service Ok("cma") on endpoint 42
  No driver for service Ok("devmotion6") on endpoint 41
  No driver for service Ok("SPUApp") on endpoint 32
  No driver for service Ok("aop-voicetrigger") on endpoint 40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant